package com.sgb.member.ui.adapter;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.makeramen.roundedimageview.RoundedImageView;
import com.sgb.member.BR;
import com.sgb.member.MemberConfig;
import com.sgb.member.R;
import com.sgb.member.databinding.ItemMemberEnterpriseBinding;
import com.sgb.member.databinding.ItemOtherCentralizedFactoryBinding;
import com.sgb.member.databinding.ItemOtherCentralizedMiningBinding;
import com.sgb.member.databinding.ItemOtherEnterpriseServiceBinding;
import com.sgb.member.databinding.ItemOtherLeaseBinding;
import com.sgb.member.databinding.ItemOtherLogisticsBinding;
import com.sgb.member.databinding.ItemOtherMaterialGoodsBinding;
import com.sgb.member.databinding.ItemPersonEnterpriseBinding;
import com.sgb.member.entity.MemberBean;
import com.sgb.member.entity.MemberBiddingEntity;
import com.sgb.member.entity.MemberBiddingPreEntity;
import com.sgb.member.entity.MemberCentralizedEntity;
import com.sgb.member.entity.MemberCentralizedFactoryEntity;
import com.sgb.member.entity.MemberFindPackersEntity;
import com.sgb.member.entity.MemberGoodsListEntity;
import com.sgb.member.entity.MemberLeaseBean;
import com.sgb.member.entity.MemberLogisticsEntity;
import com.sgb.member.entity.MemberPersonBean;
import com.sgb.member.entity.MemberServiceListBean;
import com.sgb.member.entity.MemberTeamBean;
import com.sgb.member.entity.MemberTeamPersonBean;
import com.sgb.member.entity.MemberTenderBean;
import com.sgb.member.entity.MemberTenderListEntity;
import com.sgb.member.util.MCargoConstant;
import com.sgb.member.util.MLocationUtil;
import com.sgb.member.util.MVehicleConstant;
import com.sgb.member.util.ZhaoCaiUtil;
import com.sgb.member.weight.MemberCallback;
import com.sgb.member.weight.MemberTypeLayoutManager;
import com.swgk.core.dialog.RoundCornerDialog;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.swgk.core.util.DateUtils;
import com.swgk.core.util.MToast;
import com.swgk.core.util.NumberUtil;
import com.swgk.core.util.PointUtils;
import com.swgk.core.util.SharedPreferenceUtil;
import com.swgk.core.util.StringUtil;
import com.swgk.core.util.TimeUtils;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;

public class HomeOtherMemberAdapter<T> extends BaseRecycleAdapter<T> {

    MemberCallback memberCallback;

    public HomeOtherMemberAdapter(Activity activity, int layoutId, List<T> datas) {
        super(activity, layoutId, datas);
    }

    public HomeOtherMemberAdapter(Activity activity, int layoutId, List<T> datas, MemberCallback memberCallback) {
        super(activity, layoutId, datas);
        this.memberCallback = memberCallback;
    }

    @Override
    public void convert(ItemViewHolder holder, final T t) {
        if (t instanceof MemberBean) {
            // 需方会员、供方会员
            MemberBean memberBean = (MemberBean) t;
            ItemMemberEnterpriseBinding binding = (ItemMemberEnterpriseBinding) holder.getmBinding();
            holder.setBinding(BR.viewModel, memberBean);
            binding.tvFollow.setVisibility(View.GONE);
            binding.ivMemberMore.setVisibility(View.INVISIBLE);
            String name = StringUtil.isEmpty(memberBean.getContacts()) ? "" : memberBean.getContacts();
            String phone = StringUtil.isEmpty(memberBean.getPhone()) ? "" : memberBean.getPhone();
            binding.tvPhone.setText(String.format("%s %s", name, phone));
            if (memberBean.getAllCategoryName() != null && memberBean.getAllCategoryName().size() > 0) {
                binding.childRecyclerView.setVisibility(View.VISIBLE);
                binding.childRecyclerView.setLayoutManager(new MemberTypeLayoutManager(holder.itemView.getContext()));
                binding.childRecyclerView.setAdapter(new BaseRecycleAdapter<String>(holder.itemView.getContext(), R.layout.item_member_type_lable, memberBean.getAllCategoryName()) {
                    @Override
                    public void convert(ItemViewHolder holder, String o) {
                        holder.setBinding(BR.itemBean, o);
                    }
                });
            } else {
                binding.childRecyclerView.setVisibility(View.INVISIBLE);
            }
        } else if (t instanceof MemberPersonBean) {
            //个人 需方会员、供方会员
            MemberPersonBean entity = (MemberPersonBean) t;
            ItemPersonEnterpriseBinding binding = (ItemPersonEnterpriseBinding) holder.getmBinding();
            holder.setBinding(BR.viewModel, entity);
            switch (type) {
                case 0:
                case 1:
                    // 供方会员
                    // 需方会员
                    binding.tvFollow.setVisibility(View.GONE);
                    binding.ivMemberMore.setVisibility(View.VISIBLE);
                    break;
                case 2:
                    // 企业关注会员
                    binding.tvFollow.setVisibility(View.VISIBLE);
                    binding.ivMemberMore.setVisibility(View.GONE);
                    break;
                case 3:
                    // 关注企业会员
                    binding.tvFollow.setVisibility(View.GONE);
                    binding.ivMemberMore.setVisibility(View.GONE);
                    break;
            }
            String name = StringUtil.isEmpty(entity.companyContact) ? "" : entity.companyContact;
            String phone = StringUtil.isEmpty(entity.companyPhone) ? "" : entity.companyPhone;
            binding.tvPhone.setText(String.format("%s %s", name, phone));
            if (entity.allCategoryName != null && entity.allCategoryName.size() > 0) {
                binding.childRecyclerView.setVisibility(View.VISIBLE);
                binding.childRecyclerView.setLayoutManager(new MemberTypeLayoutManager(holder.itemView.getContext()));
                binding.childRecyclerView.setAdapter(new BaseRecycleAdapter<String>(holder.itemView.getContext(),
                        R.layout.item_member_type_lable, entity.allCategoryName) {
                    @Override
                    public void convert(ItemViewHolder holder, String o) {
                        holder.setBinding(BR.itemBean, o);
                    }
                });
            } else {
                binding.childRecyclerView.setVisibility(View.INVISIBLE);
            }

        } else if (t instanceof MemberGoodsListEntity) {
            // 经营商品
            materialGoods(holder, t);
        } else if (t instanceof MemberTenderBean) {
            // 招标大厅
            tenderAll(holder, t);
        } else if (t instanceof MemberTenderListEntity) {
            // 招标公告
            tenderBidder(holder, t);
        } else if (t instanceof MemberBiddingPreEntity) {
            // 招标预告
            tenderPre(holder, t);
        } else if (t instanceof MemberBiddingEntity) {
            // 竞价招标
            tenderBid(holder, t);
        } else if (t instanceof MemberCentralizedEntity) {
            // 会员集采服务 - 需方发起、企业专项
            memberCollecting(holder, t);
        } else if (t instanceof MemberCentralizedFactoryEntity) {
            // 会员集采服务 - 供方发起
            memberCollectingFactory(holder, t);
        } else if (t instanceof MemberLeaseBean) {
            // 会员租赁
            MemberLeaseBean entity = (MemberLeaseBean) t;
            ItemOtherLeaseBinding binding = (ItemOtherLeaseBinding) holder.getmBinding();
            if (binding == null) return;
            binding.setVariable(BR.viewModel, entity);
            binding.executePendingBindings();
            binding.tvArea.setText(String.format("%s%s", StringUtil.getNotEmptyStr(entity.getCity()),
                    StringUtil.getNotEmptyStr(entity.getArea())));
            binding.tvIsSelf.setVisibility("1".equals(entity.getIsSelf()) ? View.VISIBLE : View.INVISIBLE);
//            if (!TextUtils.isEmpty(entity.getDistance())) {
//                binding.tvDistance.setVisibility(View.VISIBLE);
//                binding.tvDistance.setText(entity.getDistance());
//            } else {
//                binding.tvDistance.setVisibility(View.GONE);
//            }
            if (!TextUtils.isEmpty(entity.getAddress())) {//原来距离的位置改显示地址
                binding.tvDistance.setVisibility(View.VISIBLE);
                binding.tvDistance.setText(entity.getAddress());
            } else {
                binding.tvDistance.setVisibility(View.GONE);
            }
            try {
                binding.tvTime.setText(DateUtils.stampToDay(entity.getUpdatetime()));
            } catch (Exception e) {

            }
            if (entity.isHasQuete()) {
                binding.tvQuote.setVisibility(View.VISIBLE);
                SpannableString spannableString = StringUtil.setMoney(PointUtils.price(entity.getQuetePrice()));
                if (TextUtils.isEmpty(entity.getPriceUnit())) {
                    binding.priceView.setText(String.format("%s%s", spannableString, ""));
                } else {
                    binding.priceView.setText(String.format("%s%s", spannableString, entity.getPriceUnit()));
                }
            } else {
                binding.tvQuote.setVisibility(View.GONE);
                //和price重复判断是为了兼容旧数据
                if ("1".equals(entity.getNegotiable())) { // negotiable 是否面议 1是0不是
                    binding.priceView.setText("面议");
                } else {
                    if (Double.parseDouble(entity.getPrice()) <= 0) {
                        binding.priceView.setText("面议");
                    } else {
                        binding.priceView.setText(String.format("%s %s", entity.getPrice(), entity.getPriceUnit()));
                    }
                }
            }
            if (type == 1) {
                binding.tvLeasePrice.setVisibility(View.GONE);
                if (entity.getVipPriceUpdateTime() != null && !"0".equals(entity.getVipPriceUpdateTime())) {
//                binding.tvMemberPrice.setText(entity.getVipPriceUpdateTime() + entity.getPriceUnit());
                    binding.tvMemberPrice.setText("-");
                    //和price重复判断是为了兼容旧数据
                    if ("1".equals(entity.getNegotiable())) { // negotiable 是否面议 1是0不是
                        binding.tvPrice.setText("面议");
                    } else {
                        if (Double.parseDouble(entity.getPrice()) <= 0) {
                            binding.tvPrice.setText("面议");
                        } else {
                            binding.tvPrice.setText(String.format("%s %s", entity.getPrice(), entity.getPriceUnit()));
                        }
                    }
                    binding.tvPrice.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
                    binding.tvPrice.setVisibility(View.VISIBLE);
                    binding.tvMemberPrice.setVisibility(View.VISIBLE);
                    binding.tvPrice2.setVisibility(View.GONE);
                    binding.tvMemberPrice2.setVisibility(View.GONE);
                } else {
                    //和price重复判断是为了兼容旧数据
                    if ("1".equals(entity.getNegotiable())) { // negotiable 是否面议 1是0不是
                        binding.tvPrice2.setText("面议");
                    } else {
                        if (Double.parseDouble(entity.getPrice()) < 0) {
                            binding.tvPrice2.setText("面议");
                        } else {
                            binding.tvPrice2.setText(String.format("%s %s", entity.getPrice(), entity.getPriceUnit()));
                        }
                    }
                    binding.tvPrice2.setVisibility(View.VISIBLE);
                    binding.tvMemberPrice2.setVisibility(View.VISIBLE);
                    binding.tvPrice.setVisibility(View.GONE);
                    binding.tvMemberPrice.setVisibility(View.GONE);
                }
            } else {
                if(Double.parseDouble(entity.getPrice())>0){
                    binding.tvLeasePrice.setText(entity.getPrice()+entity.getPriceUnit());
                }else {
                    binding.tvLeasePrice.setText("面议");
                }

                binding.tvLeasePrice.setVisibility(View.VISIBLE);
                binding.tvMemberPrice.setVisibility(View.GONE);
                binding.tvPrice.setVisibility(View.GONE);
                binding.tvMemberPrice2.setVisibility(View.GONE);
                binding.tvPrice2.setVisibility(View.GONE);
                binding.llBottom.setVisibility(View.GONE);
                binding.v.setVisibility(View.GONE);
            }
        } else if (t instanceof MemberFindPackersEntity) {
            // 会员工队：施工队、班组
            MemberFindPackersEntity entity = (MemberFindPackersEntity) t;
            holder.setBinding(BR.viewModel, entity);
            ImageView iv_packer_avatar = holder.itemView.findViewById(R.id.iv_packer_avatar);
            TextView tvTime = holder.itemView.findViewById(R.id.tv_time);
            if (null != entity.getAvatarAddress() && !TextUtils.isEmpty(entity.getAvatarAddress())) {
                RequestOptions options = new RequestOptions()
                        .placeholder(R.mipmap.member_gong_dui)
                        .transforms(new CenterCrop(), new RoundedCorners(8));
                Glide.with(context).load(entity.getAvatarAddress()).apply(options).into(iv_packer_avatar);
            } else {
                Glide.with(context).load(R.mipmap.member_gong_dui).into(iv_packer_avatar);
            }
            tvTime.setText(String.format("%s 发布", DateUtils.timestampToDate(entity.getCreateTime())));
            TextView name1 = holder.itemView.findViewById(R.id.tv_packers_title);
            name1.setText(entity.getTeamName() + "");
        } else if (t instanceof MemberTeamPersonBean) {
            // 会员工队：工人（工种报价数据）
            MemberTeamPersonBean teamPriceItemEntity = (MemberTeamPersonBean) t;
            holder.setBinding(BR.viewModel, teamPriceItemEntity);
            TextView tvTime = holder.itemView.findViewById(R.id.tv_time);
            TextView tvHave = holder.itemView.findViewById(R.id.tv_have);
            if (teamPriceItemEntity.getHas_material() == 0) {
                tvHave.setText("包含辅材");
            } else if (teamPriceItemEntity.getHas_material() == 1) {
                tvHave.setText("包含设备");
            } else if (teamPriceItemEntity.getHas_material() == 2) {
                tvHave.setText("包含辅材和设备");
            } else if (teamPriceItemEntity.getHas_material() == 3) {
                tvHave.setText("不包含辅材和设备");
            }
            tvTime.setText(String.format("%s 发布", DateUtils.timestampToDate(teamPriceItemEntity.getCreate_time())));
        } else if (t instanceof MemberLogisticsEntity) {
            // 会员经营-物流货运
            logisticsGoods(holder, t);
        } else if (t instanceof MemberServiceListBean) {
            serviceItem(holder, t);
        }
    }

    @Override
    public void onBindViewHolder(ItemViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        if (holder.getmBinding() instanceof ItemPersonEnterpriseBinding) {
            ItemPersonEnterpriseBinding binding = (ItemPersonEnterpriseBinding) holder.getmBinding();
            binding.tvModifyMemberType.setVisibility(View.GONE);
            if (memberCallback == null) {
                binding.tvModifyMemberLever.setVisibility(View.GONE);
                binding.tvMemberDissolution.setVisibility(View.GONE);
            } else {
                binding.tvModifyMemberLever.setVisibility(View.VISIBLE);
                binding.tvMemberDissolution.setVisibility(View.VISIBLE);
            }
            // v1.1.1 暂时隐藏会员调级按钮
            binding.tvModifyMemberLever.setVisibility(View.GONE);
            binding.tvModifyMemberType.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                }
            });
            binding.tvModifyMemberLever.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    // 1供方会员 2需方会员
                    MemberPersonBean memberPersonBean = (MemberPersonBean) datas.get(position);
                    MemberBean memberBean = new MemberBean();
                    memberBean.setNo(memberPersonBean.no);
                    memberBean.setLevel(memberPersonBean.companyLevel);
                    memberBean.setCompanyName(memberPersonBean.companyName);
                    memberBean.setCompanyNo(memberPersonBean.companyNo);
                    // 1供方会员 2需方会员
                    if (type == 0) {
                        memberBean.setMemberUpdateLeverType("2");
                    } else if (type == 1) {
                        memberBean.setMemberUpdateLeverType("1");
                    }
                    if (memberCallback != null) {
                        memberCallback.onMemberTransfer(position, memberBean);
                    }
                }
            });
            binding.tvMemberDissolution.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    // 1供方会员 2需方会员
                    MemberPersonBean memberPersonBean = (MemberPersonBean) datas.get(position);
                    MemberBean memberBean = new MemberBean();
                    memberBean.setNo(memberPersonBean.no);
                    memberBean.setCompanyName(memberPersonBean.companyName);
                    memberBean.setCompanyNo(memberPersonBean.companyNo);
                    if (memberCallback != null) {
                        memberCallback.onMemberDissolution(position, memberBean);
                    }
                }
            });
            //        注释关注操作
//        binding.tvFollow.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                showDialog(v.getContext(), position, datas.get(position));
//            }
//        });
        }
    }

    private DecimalFormat df = new DecimalFormat("#.00");
    private static final String SELF_EMPLOYED = "1";
    private static final int PROMOTE_GOODS = 2;

    public void materialGoods(ItemViewHolder holder, T t) {
        // 会员商品
        MemberGoodsListEntity entity = ((MemberGoodsListEntity) t);
        holder.setBinding(BR.viewModel, entity);
        ItemOtherMaterialGoodsBinding itemMaterialGoodsBinding = (ItemOtherMaterialGoodsBinding) holder.getmBinding();
        itemMaterialGoodsBinding.contentView.setOnClickListener(v -> {
            if (!TextUtils.isEmpty(entity.getCompanyNo())) {
                MemberConfig.getInstance().startWebsiteInfo(context, entity.getCompanyNo(), 1);
            } else {
                MToast.showToast(context, "店铺No为空");
            }
        });
        if (entity.getPromoteStatus() == PROMOTE_GOODS) {//有促销显示促销图标
            itemMaterialGoodsBinding.imgCx.setVisibility(View.VISIBLE);
        } else
            itemMaterialGoodsBinding.imgCx.setVisibility(View.GONE);

        if (entity.getVipPrice() == 0 && entity.getPromoteStatus() != 2) {//如果会员价和促销价都没有
            itemMaterialGoodsBinding.ll1.setVisibility(View.GONE);
            itemMaterialGoodsBinding.fbl1.setVisibility(View.GONE);
            itemMaterialGoodsBinding.ll2.setVisibility(View.VISIBLE);
            itemMaterialGoodsBinding.cc2.setVisibility(View.VISIBLE);
        } else {
            itemMaterialGoodsBinding.ll1.setVisibility(View.VISIBLE);
            itemMaterialGoodsBinding.fbl1.setVisibility(View.VISIBLE);
            itemMaterialGoodsBinding.ll2.setVisibility(View.GONE);
            itemMaterialGoodsBinding.cc2.setVisibility(View.GONE);
            //会员价
            if (entity.getVipPrice() == 0) {
                itemMaterialGoodsBinding.tvHuiYuanPrice.setText("-");
                itemMaterialGoodsBinding.tvHuiYuanPrice.setTextColor(context.getResources().getColor(R.color.color_969696));
            } else {
                String vip_price = PointUtils.price(entity.getVipPrice());
                vip_price = "￥" + vip_price + "/" + entity.getUnit();
                itemMaterialGoodsBinding.tvHuiYuanPrice.setText(vip_price);
                itemMaterialGoodsBinding.tvHuiYuanPrice.setTextColor(0xffb79255);
            }
            //促销价
            if (entity.getPromoteStatus() == PROMOTE_GOODS) {
                String price = entity.getPromotePrice();
                price = "￥" + price + "/" + entity.getUnit();
                itemMaterialGoodsBinding.tvChuXiaoPrice.setText(price);
                itemMaterialGoodsBinding.tvChuXiaoPrice.setTextColor(0xffffc000);
            } else {
                itemMaterialGoodsBinding.tvChuXiaoPrice.setText("-");
                itemMaterialGoodsBinding.tvChuXiaoPrice.setTextColor(context.getResources().getColor(R.color.color_969696));

            }
            itemMaterialGoodsBinding.tvShiChangPrice.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);//文字加横线
            itemMaterialGoodsBinding.tvShiChangPrice.getPaint().setAntiAlias(true);//抗锯齿
        }

        //市场价
        if (entity.getPrice() == 0) {
            itemMaterialGoodsBinding.tvShiChangPrice.setText("-");
        } else {
            String shi_price = PointUtils.price(entity.getPrice());
            shi_price = "￥" + shi_price + "/" + entity.getUnit() + " ";
            itemMaterialGoodsBinding.tvShiChangPrice.setText(shi_price);
            itemMaterialGoodsBinding.tvShiChangPrice2.setText(shi_price);
        }

        if (MLocationUtil.isOpenLocation(context) && MLocationUtil.currentLocationIsValid()) {
            itemMaterialGoodsBinding.distanceContainer.setVisibility(View.VISIBLE);
            itemMaterialGoodsBinding.tvDistance.setText(String.format("%skm", entity.getDistance()));
        } else {
            itemMaterialGoodsBinding.distanceContainer.setVisibility(View.GONE);
        }

        if (SELF_EMPLOYED.equals(entity.getSelfSupportTag())) {
            itemMaterialGoodsBinding.labelContainer.setVisibility(View.VISIBLE);
            itemMaterialGoodsBinding.imageZiying.setVisibility(View.VISIBLE);
        } else {
            itemMaterialGoodsBinding.labelContainer.setVisibility(View.GONE);
            itemMaterialGoodsBinding.imageZiying.setVisibility(View.GONE);
        }

        if (entity.isSellGoodGoods()) {
            if (entity.getRanking() == 1) {
                itemMaterialGoodsBinding.ivRanking.setImageResource(R.mipmap.micon_good_number1);
            } else if (entity.getRanking() == 2) {
                itemMaterialGoodsBinding.ivRanking.setImageResource(R.mipmap.micon_good_number2);
            } else if (entity.getRanking() == 3) {
                itemMaterialGoodsBinding.ivRanking.setImageResource(R.mipmap.micon_good_number3);
            } else {
                itemMaterialGoodsBinding.ivRanking.setImageDrawable(null);
            }
            if (entity.getBrandName() == null || "".equals(entity.getBrandName())) {
                itemMaterialGoodsBinding.tvBrandName.setVisibility(View.GONE);
                if (SELF_EMPLOYED.equals(entity.getSelfSupportTag())) {
                    itemMaterialGoodsBinding.labelContainer.setVisibility(View.VISIBLE);
                } else {
                    itemMaterialGoodsBinding.labelContainer.setVisibility(View.GONE);
                }
            } else {
                itemMaterialGoodsBinding.labelContainer.setVisibility(View.VISIBLE);
                itemMaterialGoodsBinding.tvBrandName.setVisibility(View.VISIBLE);
                itemMaterialGoodsBinding.tvBrandName.setText(entity.getBrandName());
            }
        }
        // itemMaterialGoodsBinding.tvStorageName.setText(String.format("仓储: %s", entity.getStorageName()));

        /*itemMaterialGoodsBinding.cuPrice.setVisibility(View.GONE);
        itemMaterialGoodsBinding.priceView.setVisibility(View.GONE);
        String price = "";
        if (entity.isHasQuete()) {
            itemMaterialGoodsBinding.tvQuote.setVisibility(View.VISIBLE);
            itemMaterialGoodsBinding.imgCx.setVisibility(View.GONE);
            itemMaterialGoodsBinding.tvLastPrice.setVisibility(View.GONE);
            price = PointUtils.price(entity.getQuetePrice());
        } else {
            itemMaterialGoodsBinding.tvQuote.setVisibility(View.GONE);
            if (entity.getPromoteStatus() == PROMOTE_GOODS) {
                itemMaterialGoodsBinding.imgCx.setVisibility(View.VISIBLE);
                itemMaterialGoodsBinding.tvLastPrice.setVisibility(View.VISIBLE);
                itemMaterialGoodsBinding.tvLastPrice.setText(String.format("%s/%s", PointUtils.price(entity.getPrice()), entity.getUnit()));
                StringUtil.setNoddleLine(entity.getPromotePrice());
            } else {
                itemMaterialGoodsBinding.imgCx.setVisibility(View.GONE);
                itemMaterialGoodsBinding.tvLastPrice.setVisibility(View.GONE);
            }
            price = PointUtils.price(entity.getPromotePrice());
        }
        String s = "￥" + price + "/" + entity.getUnit();
        SpannableString spannableString = new SpannableString(s);
        spannableString.setSpan(new AbsoluteSizeSpan(12, true), s.indexOf("￥"), 1, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
        spannableString.setSpan(new AbsoluteSizeSpan(14, true), 1, s.indexOf("."), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
        spannableString.setSpan(new AbsoluteSizeSpan(12, true), s.indexOf("."), s.indexOf("/"), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
        spannableString.setSpan(new AbsoluteSizeSpan(11, true), s.indexOf("/"), s.length(), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
        itemMaterialGoodsBinding.tvSpec.setText(spannableString);*/
    }

    @SuppressLint("ClickableViewAccessibility")
    public void tenderAll(ItemViewHolder holder, T t) {
        MemberTenderBean entity = (MemberTenderBean) t;
        holder.setBinding(BR.viewModel, entity);
        RecyclerView recyclerView = holder.itemView.findViewById(R.id.child_rv);
        LinearLayout noList = holder.itemView.findViewById(R.id.no_list);
        TextView noListText = holder.itemView.findViewById(R.id.no_list_text);
        ImageView imgTab = holder.itemView.findViewById(R.id.img_tab);
        LinearLayout linePrice = holder.itemView.findViewById(R.id.line_price);
        TextView priceTitle = holder.itemView.findViewById(R.id.price_title);
        TextView priceContent = holder.itemView.findViewById(R.id.price_content);
        TextView tvTypeName = holder.itemView.findViewById(R.id.tv_type_name);
        TextView tvEndTime = holder.itemView.findViewById(R.id.tv_endTime);
        TextView name = holder.itemView.findViewById(R.id.name);
        TextView tvVerticalType = holder.itemView.findViewById(R.id.tv_vertical_type);
        TextView textViewWheel = holder.itemView.findViewById(R.id.tv_wheel_num);
        TextView tvType3 = holder.itemView.findViewById(R.id.tv_type3);
        TextView tv_two_type = holder.itemView.findViewById(R.id.tv_two_type);
        LinearLayout ll_company = holder.itemView.findViewById(R.id.ll_company);
        LinearLayout ll_address = holder.itemView.findViewById(R.id.ll_address);
        TextView tv_address_name = holder.itemView.findViewById(R.id.tv_address_name);
        if (entity.getBusinessType() == 1) {
            TextView tv_company = holder.itemView.findViewById(R.id.tv_company);
            tv_company.setText(entity.getComName());
            tv_address_name.setText(entity.getRegion() + entity.getAddress());
            ll_company.setVisibility(View.VISIBLE);
            ll_address.setVisibility(View.VISIBLE);
        } else {
            ll_company.setVisibility(View.GONE);
            ll_address.setVisibility(View.GONE);
        }

        if (entity.getBusinessType() == 3) {
            name.setText(entity.getProjectName());
        } else {
            name.setText(entity.getName());
        }

        if (entity.getBusinessType() == 1) {   // 1.招标； 2.竞价 3。需求预告
            tv_two_type.setVisibility(View.GONE);
//            if (type == 0) {
                tvTypeName.setText(entity.getTypeName());
                tvTypeName.setVisibility(View.VISIBLE);
//            } else {
//                tvTypeName.setText("");
//                tvTypeName.setVisibility(View.GONE);
//            }
            tvType3.setVisibility(View.GONE);
            // 招标方式：1、资格预审；2、资格后审；3、报价即报名
            if (entity.getVerticalTypeValue() > 0) {
                tvVerticalType.setVisibility(View.VISIBLE);
            } else {
                tvVerticalType.setVisibility(View.GONE);
            }
            if (1 == entity.getVerticalTypeValue()) {
                tvVerticalType.setText("资格预审");
            } else if (2 == entity.getVerticalTypeValue()) {
                tvVerticalType.setText("资格后审");
            } else if (3 == entity.getVerticalTypeValue()) {
                tvVerticalType.setText("报名即报价");
            }
            switch (entity.getState()) {
                case 2:
                case 6://正在招标
                    tvEndTime.setText(String.format("投标结束时间：%s", TextUtils.isEmpty(entity.getEndTimeStr()) ? "" : entity.getEndTimeStr()));
                    imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zbz));
                    break;
                case 4://招标定标
                    tvEndTime.setText(String.format("定标时间：%s", TextUtils.isEmpty(entity.getUpdatedStr()) ? "" : entity.getUpdatedStr()));
                    imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zbdj));
                    break;
                case 9://招标报名
                    tvEndTime.setText(String.format("报名结束时间：%s", TextUtils.isEmpty(entity.getApplyEndTimeStr()) ? "" : entity.getApplyEndTimeStr()));
                    imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zbbm));
                    break;
                case 3://竞标评标
                    tvEndTime.setText(String.format("开标时间：%s", TextUtils.isEmpty(entity.getBidTimeStr()) ? "" : entity.getBidTimeStr()));
                    imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_pick_pbz));
                    break;
                case 1://即将招标
                    tvEndTime.setText(String.format("投标开始时间：%s", TextUtils.isEmpty(entity.getStartTimeStr()) ? "" : entity.getStartTimeStr()));
                    imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_pick_jjzb));
                    break;
                case 8://招标预告
                    tvEndTime.setText(String.format("报名开始时间：%s", TextUtils.isEmpty(entity.getApplyStartTimeStr()) ? "" : entity.getApplyStartTimeStr()));
                    imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zbyg));
                    break;
            }

            //新增 “招标轮次”     “报名中”9、“待招标”1状态不显示，其他状态显示    接口判断
            if (0 == entity.getRotation() || entity.getState() == 1 || entity.getState() == 8 || entity.getState() == 9) {
                textViewWheel.setVisibility(View.GONE);
            } else {
                textViewWheel.setVisibility(View.VISIBLE);
                textViewWheel.setText(String.format("第%s轮", entity.getRotation()));
            }

            if (entity.getGoodsLists() == null) {
                recyclerView.setVisibility(View.GONE);
                noList.setVisibility(View.VISIBLE);
                noListText.setText("该类型无招标清单");
            } else {
                recyclerView.setVisibility(View.VISIBLE);
                noList.setVisibility(View.GONE);
                MemberHotChildHeadAdapter pickHomeHotChildHeadAdapter = new MemberHotChildHeadAdapter(context, entity.getGoodsHeaders(), entity.getGoodsLists());
                recyclerView.setLayoutManager(new LinearLayoutManager(context));
                recyclerView.setAdapter(pickHomeHotChildHeadAdapter);
                pickHomeHotChildHeadAdapter.setDisplay(entity.getIsDisplay());
                pickHomeHotChildHeadAdapter.setOnItemClick(new MemberHotChildHeadAdapter.OnItemClick() {
                    @Override
                    public void onItemClick() {
                        iChildClick.onClick(t);
                    }
                });
            }

        } else if (entity.getBusinessType() == 2) {
            tv_two_type.setVisibility(View.GONE);
//            if (type == 0) {
                tvTypeName.setText(entity.getTypeName());
                tvTypeName.setVisibility(View.VISIBLE);
//            } else {
//                tvTypeName.setText("");
//                tvTypeName.setVisibility(View.GONE);
//            }

            tvVerticalType.setVisibility(View.GONE);
            textViewWheel.setVisibility(View.GONE);
            tvType3.setVisibility(View.GONE);
            if (2 == entity.getState()) {//竞价中
                tvEndTime.setText(String.format("发布时间：%s", TextUtils.isEmpty(entity.getCreatedStr()) ? "" : entity.getCreatedStr()));
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_jjz));
            } else if (3 == entity.getState()) {//已结束
                tvEndTime.setText(String.format("定标时间：%s", TextUtils.isEmpty(entity.getUpdatedStr()) ? "" : entity.getUpdatedStr()));
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_yjs));
            } else if (5 == entity.getState()) {//废标
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_fb));
            } else if (7 == entity.getState()) {//流标
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_liubiao));
            }

            if (entity.getGoodsHeaders() == null || entity.getGoodsLists() == null) {
                recyclerView.setVisibility(View.GONE);
                noList.setVisibility(View.VISIBLE);
                noListText.setText("该类型无竞价清单");
                if (entity.getIsDisplay() == 0) {   //0、隐藏；1、展示；
                    linePrice.setVisibility(View.GONE);
                } else {
                    linePrice.setVisibility(View.VISIBLE);
                    if (entity.getType() == 6 || entity.getType() == 7 || entity.getType() == 8 || entity.getType() == 9 || entity.getType() == 10 || entity.getType() == 13 || entity.getType() == 20) {
                        if (TextUtils.isEmpty(entity.getMinMoney())) {
                            priceTitle.setText("最低报价:  -");
                            priceContent.setText("");
                        } else {
                            priceTitle.setText("最低报价:");
                            BigDecimal bg = new BigDecimal(entity.getMinMoney());
                            String text = bg.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString();
                            priceContent.setText(text + "元");
                        }
                    }
                }
            } else {
                recyclerView.setVisibility(View.VISIBLE);
                noList.setVisibility(View.GONE);
                linePrice.setVisibility(View.GONE);
                MemberHotChildHeadAdapter pickHomeHotChildHeadAdapter = new MemberHotChildHeadAdapter(context, entity.getGoodsHeaders(), entity.getGoodsLists());
                recyclerView.setLayoutManager(new LinearLayoutManager(context));
                recyclerView.setAdapter(pickHomeHotChildHeadAdapter);
                pickHomeHotChildHeadAdapter.setDisplay(entity.getIsDisplay());
                pickHomeHotChildHeadAdapter.setOnItemClick(new MemberHotChildHeadAdapter.OnItemClick() {
                    @Override
                    public void onItemClick() {
                        iChildClick.onClick(t);
                    }
                });
            }

        } else if (entity.getBusinessType() == 3) {
            tv_two_type.setVisibility(View.VISIBLE);
            tvTypeName.setText(entity.getTypeName());
            tvTypeName.setVisibility(View.VISIBLE);
            textViewWheel.setVisibility(View.GONE);
            tvType3.setVisibility(View.VISIBLE);
            tvVerticalType.setVisibility(View.GONE);
            //标签
            tv_two_type.setText(entity.getModuleType());//二级分类
            tvType3.setText(entity.getLabel());//一级分类
            String created = entity.getCreated();
            int indexT = created.indexOf("T");
            tvEndTime.setText(String.format("发布时间：%s", TextUtils.isEmpty(entity.getCreated()) ? "" : created.substring(0, indexT)));
            imgTab.setVisibility(View.VISIBLE);
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zjz));
            MemberHotChildHeadAdapter pickHomeHotChildHeadAdapter = new MemberHotChildHeadAdapter(context, entity.getGoodsHeaders(), entity.getGoodsLists());
            recyclerView.setLayoutManager(new LinearLayoutManager(context));
            recyclerView.setAdapter(pickHomeHotChildHeadAdapter);
            pickHomeHotChildHeadAdapter.setDisplay(entity.getIsDisplay());
            pickHomeHotChildHeadAdapter.setOnItemClick(new MemberHotChildHeadAdapter.OnItemClick() {
                @Override
                public void onItemClick() {
                    iChildClick.onClick(t);
                }
            });
        }
    }


    private void tenderBid(ItemViewHolder holder, T t) {
        // item_pick_bidding2
        MemberBiddingEntity entity = (MemberBiddingEntity) t;
        holder.setBinding(BR.viewModel, entity);
        ImageView imgTab = holder.itemView.findViewById(R.id.img_tab);
        TextView tvTypeName = holder.itemView.findViewById(R.id.tv_type_name);
        RecyclerView recyclerView = holder.itemView.findViewById(R.id.child_rv);
        LinearLayout noList = holder.itemView.findViewById(R.id.no_list);
        LinearLayout linePrice = holder.itemView.findViewById(R.id.line_price);
        TextView priceTitle = holder.itemView.findViewById(R.id.price_title);
        TextView priceContent = holder.itemView.findViewById(R.id.price_content);
        TextView tvEndTime = holder.itemView.findViewById(R.id.tv_endTime);
        imgTab.setVisibility(View.VISIBLE);

        TextView tv_company = holder.itemView.findViewById(R.id.tv_company);
        tv_company.setText(entity.getCompanyName());
        TextView tv_address_name = holder.itemView.findViewById(R.id.tv_address_name);
        tv_address_name.setText(entity.getRegion()+entity.getAddress());

        if (2 == entity.getState()) {
            tvEndTime.setText(String.format("截止时间：%s", TextUtils.isEmpty(entity.getDeadlineTime()) ? "" : entity.getDeadlineTime()));
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_jjz));
        } else if (3 == entity.getState()) {
            tvEndTime.setText(String.format("定标时间：%s", TextUtils.isEmpty(entity.getUpdatedStr()) ? "" : entity.getUpdatedStr()));
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_yjs));
        }
//        else if (5 == entity.getState()) {
//            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_fb));
//        }
        else if (7 == entity.getState()) {
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_liubiao));
        }
        else if (5 == entity.getState()) {
           // Log.i("xxx"," ==="+entity.getCreatedStr()+"   "+entity.getDeadlineTime());
            tvEndTime.setText(String.format("截止时间：%s", TextUtils.isEmpty(entity.getDeadlineTime()) ? "" : entity.getDeadlineTime()));
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_tan_pan_ing));
        }
//        if (type == 0) {
            tvTypeName.setText(entity.getTypeName());
            tvTypeName.setVisibility(View.VISIBLE);
//        } else {
//            tvTypeName.setText("");
//            tvTypeName.setVisibility(View.GONE);
//        }

        if (entity.getGoodsHeaders() == null || entity.getGoodsLists() == null) {
            recyclerView.setVisibility(View.GONE);
            noList.setVisibility(View.VISIBLE);
            if (entity.getIsDisplay() == 0) {   //0、隐藏；1、展示；
                linePrice.setVisibility(View.GONE);
            } else {
                linePrice.setVisibility(View.VISIBLE);
                if (entity.getType() == 6 || entity.getType() == 7 || entity.getType() == 8 || entity.getType() == 9 || entity.getType() == 10 || entity.getType() == 13 || entity.getType() == 20) {
                    if (TextUtils.isEmpty(entity.getMinPrice())) {
                        priceTitle.setText("最低报价:  -");
                        priceContent.setText("");
                    } else {
                        priceTitle.setText("最低报价:");
                        priceContent.setText(String.format("%s元", entity.getMinPrice()));
                    }
                }
            }
        } else {
            recyclerView.setVisibility(View.VISIBLE);
            noList.setVisibility(View.GONE);
            linePrice.setVisibility(View.GONE);
            MemberHotChildHeadAdapter pickHomeHotChildHeadAdapter = new MemberHotChildHeadAdapter(context, entity.getGoodsHeaders(), entity.getGoodsLists());
            recyclerView.setLayoutManager(new LinearLayoutManager(context));
            recyclerView.setAdapter(pickHomeHotChildHeadAdapter);
            pickHomeHotChildHeadAdapter.setDisplay(entity.getIsDisplay());
            pickHomeHotChildHeadAdapter.setOnItemClick(new MemberHotChildHeadAdapter.OnItemClick() {
                @Override
                public void onItemClick() {
                    iChildClick.onClick(t);
                }
            });
        }
    }

    private void tenderPre(ItemViewHolder holder, T t) {
        // item_pick_notice
        MemberBiddingPreEntity goodsInfoEntity3 = (MemberBiddingPreEntity) t;
        holder.setBinding(BR.viewModel, goodsInfoEntity3);
        RecyclerView recyclerView = holder.itemView.findViewById(R.id.child_rv);
        LinearLayout noList = holder.itemView.findViewById(R.id.no_list);

        if (goodsInfoEntity3.getGoodsHeaders() == null || goodsInfoEntity3.getGoodsLists() == null) {
            recyclerView.setVisibility(View.GONE);
            noList.setVisibility(View.VISIBLE);
        } else {
            recyclerView.setVisibility(View.VISIBLE);
            noList.setVisibility(View.GONE);
            MemberHotChildHeadAdapter pickHomeHotChildHeadAdapter = new MemberHotChildHeadAdapter(context, goodsInfoEntity3.getGoodsHeaders(), goodsInfoEntity3.getGoodsLists());
            recyclerView.setLayoutManager(new LinearLayoutManager(context));
            recyclerView.setAdapter(pickHomeHotChildHeadAdapter);
            pickHomeHotChildHeadAdapter.setOnItemClick(new MemberHotChildHeadAdapter.OnItemClick() {
                @Override
                public void onItemClick() {
                    iChildClick.onClick(t);
                }
            });
        }

        ImageView imgTab = holder.itemView.findViewById(R.id.img_status_bidding);
        TextView tvStartTime = holder.itemView.findViewById(R.id.text_start_time);
        TextView tv_type2 = holder.itemView.findViewById(R.id.tv_type2);
        TextView tvType = holder.itemView.findViewById(R.id.tv_type);
        TextView tv_company = holder.itemView.findViewById(R.id.tv_company);
        tv_company.setText(goodsInfoEntity3.getComName());
        TextView tv_address_name = holder.itemView.findViewById(R.id.tv_address_name);
        tv_address_name.setText(goodsInfoEntity3.getRegion());
        // 招标方式：1、资格预审；2、资格后审；3、报价即报名
        int imageId = 0;
        if (null == goodsInfoEntity3.getVerticalTypeValue()) {
            goodsInfoEntity3.setVerticalTypeValue(0);
        }
        if (goodsInfoEntity3.getVerticalTypeValue() > 0) {
            tvType.setVisibility(View.VISIBLE);
        } else {
            tvType.setVisibility(View.GONE);
        }
        if (1 == goodsInfoEntity3.getVerticalTypeValue()) {
            tvType.setText("资格预审");
        } else if (2 == goodsInfoEntity3.getVerticalTypeValue()) {
            tvType.setText("资格后审");
        } else if (3 == goodsInfoEntity3.getVerticalTypeValue()) {
            tvType.setText("报名即报价");
        }

        imgTab.setVisibility(View.VISIBLE);
        tvStartTime.setVisibility(View.VISIBLE);
        if (goodsInfoEntity3.getState() == 2) {
            tvStartTime.setText("投标结束时间:  " + DateUtils.stampToDay(String.valueOf(goodsInfoEntity3.getEndTime())));
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zbz));
        } else if (goodsInfoEntity3.getState() == 4) {
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zbjs));
        } else if (goodsInfoEntity3.getState() == 9) {
            tvStartTime.setText("报名结束时间:  " + DateUtils.stampToDay(String.valueOf(goodsInfoEntity3.getApplyEndTime())));
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_bmz));
        } else if (goodsInfoEntity3.getState() == 3) {
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_pbz));
        } else if (goodsInfoEntity3.getState() == 6) {
            tvStartTime.setText("投标结束时间:  " + DateUtils.stampToDay(String.valueOf(goodsInfoEntity3.getEndTime())));
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zbz));
        } else if (goodsInfoEntity3.getState() == 1) {
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_dzb));
        } else if (goodsInfoEntity3.getState() == 8) {
            tvStartTime.setText("报名开始时间:  " + DateUtils.stampToDay(String.valueOf(goodsInfoEntity3.getApplyStartTime())));
            imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_dbm));
        } else {
            imgTab.setVisibility(View.GONE);
        }


        if (TextUtils.isEmpty(goodsInfoEntity3.getGoodsTypeName())) {
            if (goodsInfoEntity3.getType() == 1) {
                tv_type2.setText("机械租赁");
            } else if (goodsInfoEntity3.getType() == 2) {
                tv_type2.setText("劳务分包");
            } else if (goodsInfoEntity3.getType() == 3) {
                tv_type2.setText("商品&材料");
            } else if (goodsInfoEntity3.getType() == 4) {
                tv_type2.setText("专业工程");
            } else if (goodsInfoEntity3.getType() == 5) {
                tv_type2.setText("设备租赁");
            } else if (goodsInfoEntity3.getType() == 6) {
                tv_type2.setText("地质勘察");
            } else if (goodsInfoEntity3.getType() == 7) {
                tv_type2.setText("设计规则");
            } else if (goodsInfoEntity3.getType() == 8) {
                tv_type2.setText("专业监理");
            } else if (goodsInfoEntity3.getType() == 9) {
                tv_type2.setText("造价咨询");
            } else if (goodsInfoEntity3.getType() == 10) {
                tv_type2.setText("工程总包");
            } else if (goodsInfoEntity3.getType() == 11) {
                tv_type2.setText("房产租赁");
            } else if (goodsInfoEntity3.getType() == 12) {
                tv_type2.setText("车辆租赁");
            } else if (goodsInfoEntity3.getType() == 13) {
                tv_type2.setText("PPP项目");
            } else if (goodsInfoEntity3.getType() == 14) {
                tv_type2.setText("土地产权转让");
            } else if (goodsInfoEntity3.getType() == 15) {
                tv_type2.setText("房产转让");
            } else if (goodsInfoEntity3.getType() == 16) {
                tv_type2.setText("机械转让");
            } else if (goodsInfoEntity3.getType() == 17) {
                tv_type2.setText("设备转让");
            } else if (goodsInfoEntity3.getType() == 18) {
                tv_type2.setText("车辆转让");
            } else if (goodsInfoEntity3.getType() == 19) {
                tv_type2.setText("物流货运");
            } else if (goodsInfoEntity3.getType() == 20) {
                tv_type2.setText("其他");
            } else {
                tv_type2.setVisibility(View.GONE);
            }
            if (type == 0 && !TextUtils.isEmpty(tv_type2.getText())) {
                tv_type2.setVisibility(View.VISIBLE);
            } else {
                tv_type2.setVisibility(View.GONE);
            }
        } else {
//            if (type == 0) {
                tv_type2.setText(goodsInfoEntity3.getGoodsTypeName());
                tv_type2.setVisibility(View.VISIBLE);
//            } else {
//                tv_type2.setVisibility(View.GONE);
//            }
        }
    }


    private void tenderBidder(ItemViewHolder holder, T t) {
        MemberTenderListEntity entity = (MemberTenderListEntity) t;
        holder.setBinding(BR.viewModel, entity);
        // item_pick_hall_biding
        RecyclerView recyclerView = holder.itemView.findViewById(R.id.child_rv);
        LinearLayout noList = holder.itemView.findViewById(R.id.no_list);

        if (entity.getGoodsHeaders() == null || entity.getGoodsLists() == null) {
            recyclerView.setVisibility(View.GONE);
            noList.setVisibility(View.VISIBLE);
        } else {
            recyclerView.setVisibility(View.VISIBLE);
            noList.setVisibility(View.GONE);
            MemberHotChildHeadAdapter pickHomeHotChildHeadAdapter = new MemberHotChildHeadAdapter(context, entity.getGoodsHeaders(), entity.getGoodsLists());
            recyclerView.setLayoutManager(new LinearLayoutManager(context));
            recyclerView.setAdapter(pickHomeHotChildHeadAdapter);
            pickHomeHotChildHeadAdapter.setOnItemClick(new MemberHotChildHeadAdapter.OnItemClick() {
                @Override
                public void onItemClick() {
                    iChildClick.onClick(t);
                }
            });
        }

        ImageView imgTab = holder.itemView.findViewById(R.id.img_tab);
        TextView tvType2 = holder.itemView.findViewById(R.id.tv_type2);
        TextView tvEndTime = holder.itemView.findViewById(R.id.tv_endTime);
        TextView name = holder.itemView.findViewById(R.id.name);
        TextView tvType = holder.itemView.findViewById(R.id.tv_type);
        TextView tv_company = holder.itemView.findViewById(R.id.tv_company);
        tv_company.setText(entity.getCompanyName());
        TextView tv_address_name = holder.itemView.findViewById(R.id.tv_address_name);
        tv_address_name.setText(entity.getRegion() + entity.getAddress());


        // 招标方式：1、资格预审；2、资格后审；3、报价即报名
        if (null == entity.getVerticalTypeValue()) {
            entity.setVerticalTypeValue(0);
        }
        if (entity.getVerticalTypeValue() > 0) {
            tvType.setVisibility(View.VISIBLE);
        } else {
            tvType.setVisibility(View.GONE);
        }
        if (1 == entity.getVerticalTypeValue()) {
            tvType.setText("资格预审");
        } else if (2 == entity.getVerticalTypeValue()) {
            tvType.setText("资格后审");
        } else if (3 == entity.getVerticalTypeValue()) {
            tvType.setText("报名即报价");
        }

        imgTab.setVisibility(View.VISIBLE);
        switch (entity.getStatus()) {
            case "2":
            case "6":
                tvEndTime.setText(String.format("投标结束时间：%s", TextUtils.isEmpty(entity.getEndTimeStr()) ? "" : entity.getEndTimeStr()));
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zbz));
                break;
            case "4":
                tvEndTime.setText(String.format("定标时间：%s", TextUtils.isEmpty(entity.getUpdatedStr()) ? "" : entity.getUpdatedStr()));
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zbdj));
                break;
            case "9":
                tvEndTime.setText(String.format("报名结束时间：%s", TextUtils.isEmpty(entity.getApplyEndTimeStr()) ? "" : entity.getApplyEndTimeStr()));
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zbbm));
                break;
            case "3":
                tvEndTime.setText(String.format("开标时间：%s", TextUtils.isEmpty(entity.getBidTimeStr()) ? "" : entity.getBidTimeStr()));
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_jbpb));
                break;
            case "1":
                tvEndTime.setText(String.format("投标开始时间：%s", TextUtils.isEmpty(entity.getStartTimeStr()) ? "" : entity.getStartTimeStr()));
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_pick_jjzb));
                break;
            case "8":
                tvEndTime.setText(String.format("报名开始时间：%s", TextUtils.isEmpty(entity.getEndTimeStr()) ? "" : entity.getEndTimeStr()));
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_zbyg));
                break;
            case "5":
                tvEndTime.setText(String.format("废标时间：%s", TextUtils.isEmpty(entity.getUpdatedStr()) ? "" : entity.getUpdatedStr()));
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_fb));
                break;
            case "7":
                tvEndTime.setText(String.format("流标时间：%s", TextUtils.isEmpty(entity.getUpdatedStr()) ? "" : entity.getUpdatedStr()));
                imgTab.setBackground(context.getResources().getDrawable(R.mipmap.member_icon_liubiao));
                break;
            default:
                imgTab.setVisibility(View.GONE);
                break;
        }

//        if (type == 0) {
            //  tvType2.setText(entity.getTypeName());
            tvType2.setText(ZhaoCaiUtil.getTypeForName(entity.getType()));
            tvType2.setVisibility(View.VISIBLE);
//        } else {
//            tvType2.setText("");
//            tvType2.setVisibility(View.GONE);
//        }

        name.setText(entity.getName());

        //新增 “招标轮次”     “报名中”9、“待招标”1状态不显示，其他状态显示    接口判断
        TextView textViewWheel = holder.itemView.findViewById(R.id.tv_wheel_num);
        if (TextUtils.isEmpty(entity.getRotation()) || "0".equals(entity.getRotation()) || "1".equals(entity.getStatus()) || "8".equals(entity.getStatus()) || "9".equals(entity.getStatus())) {
            textViewWheel.setVisibility(View.GONE);
        } else {
            textViewWheel.setVisibility(View.VISIBLE);
            textViewWheel.setText("第" + entity.getRotation() + "轮");
        }
    }

    private int type; // 判断是商品/材料等或者全部（全部为0）

    public void setType(int type) {
        this.type = type;
    }

    private IChildClick<T> iChildClick;

    public void onIChildClick(IChildClick<T> iChildClick) {
        this.iChildClick = iChildClick;
    }

    public interface IChildClick<T> {
        void onClick(T tenderListEntity);
    }

    /**
     * -------------------------------------------------------
     */

    private void memberCollectingFactory(ItemViewHolder holder, T t) {
        holder.setBinding(BR.viewModel, t);
        MemberCentralizedFactoryEntity entity = (MemberCentralizedFactoryEntity) t;
        ItemOtherCentralizedFactoryBinding binding = (ItemOtherCentralizedFactoryBinding) holder.getmBinding();
        binding.ent.setVisibility(View.VISIBLE);
        binding.ent.setOnClickListener(view ->
                MemberConfig.getInstance().startWebsiteInfo(context, entity.getCompanyNo(), MemberConfig.WEBSITE_FOR_COMPANY));
        binding.childRecycler.setLayoutManager(new LinearLayoutManager(binding.childRecycler.getContext()));
        MemberCentralizedFactoryChildAdapter childAdapter = new MemberCentralizedFactoryChildAdapter(binding.childRecycler.getContext(), entity.getProductSaleSlipDetails());
        binding.childRecycler.setAdapter(childAdapter);
        childAdapter.setOnItemClick(new AdapterOnItemClick<MemberCentralizedFactoryEntity.ProductSaleSlipDetails>() {
            @Override
            public void onItemClick(MemberCentralizedFactoryEntity.ProductSaleSlipDetails productSaleSlipDetails, int position) {
                if (iChildClick != null) {
                    iChildClick.onClick(t);
                }
            }
        });
        // 集采状态状态1 集采中 2 集采完成
        if (entity.getStatus() == 1) {
            switch (entity.getPriceWarning()) {//价格预警 1 大于 2 等于 3 小于
                case 1:
                    binding.imgTab.setImageResource(R.mipmap.member_icon_jcz_dy);
                    break;
                case 2:
                    binding.imgTab.setImageResource(R.mipmap.member_icon_jcz_dengyu);
                    break;
                case 3:
                    binding.imgTab.setImageResource(R.mipmap.member_icon_jcz_xy);
                    break;
                default:
                    binding.imgTab.setImageResource(R.mipmap.member_icon_jcz_dengyu);
                    break;
            }
        } else {
            binding.imgTab.setImageResource(R.mipmap.member_icon_jcwc);
        }
    }

    private void memberCollecting(ItemViewHolder holder, T t) {
        holder.setBinding(BR.viewModel, t);
        MemberCentralizedEntity entity = (MemberCentralizedEntity) t;
        boolean isVisible = false; // 是否显示进入商店入口
        ((ItemOtherCentralizedMiningBinding) holder.getmBinding()).ent.setVisibility(isVisible ? View.VISIBLE : View.GONE);
        ((ItemOtherCentralizedMiningBinding) holder.getmBinding()).ent.setOnClickListener(view ->
                MemberConfig.getInstance().startWebsiteInfo(context, entity.getCompanyNo(), MemberConfig.WEBSITE_FOR_COMPANY));
        updateRecycler(((ItemOtherCentralizedMiningBinding) holder.getmBinding()).childRecycler, entity);
        updateImageStatus(((ItemOtherCentralizedMiningBinding) holder.getmBinding()).imgTab, entity);
        updateParamName(((ItemOtherCentralizedMiningBinding) holder.getmBinding()).tvParamName, ((ItemOtherCentralizedMiningBinding) holder.getmBinding()).tvFloorPrice, entity);
        updateGroupBuyType(((ItemOtherCentralizedMiningBinding) holder.getmBinding()).tvStatus, entity);
        updateSecondlyType(((ItemOtherCentralizedMiningBinding) holder.getmBinding()).tvSecondlyType, entity);
        updateQuotationType(((ItemOtherCentralizedMiningBinding) holder.getmBinding()).tvQuotationType, entity);
        updateJoinType(((ItemOtherCentralizedMiningBinding) holder.getmBinding()).tvJoinType, entity);
        if (entity.getGroupBuyMode().equals("1")) {
            ((ItemOtherCentralizedMiningBinding) holder.getmBinding()).tvJoinType.setVisibility(View.GONE);
        } else {
            ((ItemOtherCentralizedMiningBinding) holder.getmBinding()).tvJoinType.setVisibility(View.VISIBLE);
        }
    }

    private void updateRecycler(RecyclerView recyclerView, MemberCentralizedEntity entity) {
        recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
        MemberCentralizedChildAdapter childAdapter = new MemberCentralizedChildAdapter(recyclerView.getContext(), entity.getGoodsEntity());
        recyclerView.setAdapter(childAdapter);
        childAdapter.setOnItemClick(new AdapterOnItemClick<MemberCentralizedEntity.GoodsEntity>() {
            @Override
            public void onItemClick(MemberCentralizedEntity.GoodsEntity goodsEntity, int position) {
                if (iChildClick != null) {
                    iChildClick.onClick((T) entity);
                }
            }
        });
    }

    private void updateImageStatus(ImageView imageView, MemberCentralizedEntity entity) {
        // 集采状态（1 集采中 2 集采结束 4 集采失败 5 加盟中 6 报价中 ）
        switch (entity.getStatus()) {
            case 1:
                switch (entity.getPriceWarning()) {//价格预警 1 大于 2 等于 3 小于
                    case 1:
                        imageView.setImageResource(R.mipmap.member_icon_jcz_dy);
                        break;
                    case 2:
                        imageView.setImageResource(R.mipmap.member_icon_jcz_dengyu);
                        break;
                    case 3:
                        imageView.setImageResource(R.mipmap.member_icon_jcz_xy);
                        break;
                    default:
                        imageView.setImageResource(R.mipmap.member_icon_jcz_dengyu);
                        break;
                }
                break;
            case 2:
                imageView.setImageResource(R.mipmap.member_icon_jcwc);
                break;
            case 4:
                imageView.setImageResource(R.mipmap.member_icon_jcsb);
                break;
            case 5:
                imageView.setImageResource(R.mipmap.member_icon_jmz_qt);
                break;
            case 6:
                switch (entity.getPriceWarning()) {//价格预警 1 大于 2 等于 3 小于
                    case 1:
                        imageView.setImageResource(R.mipmap.member_icon_bjz_dy);
                        break;
                    case 2:
                        imageView.setImageResource(R.mipmap.member_icon_bjz_dengyu);
                        break;
                    case 3:
                        imageView.setImageResource(R.mipmap.member_icon_bjz_xy);
                        break;
                }
//                imageView.setImageResource(R.drawable.icon_bjz);
                break;
            default:
                imageView.setImageResource(R.mipmap.member_icon_jcz);
                break;
        }
    }

    private void updateParamName(TextView tvParamName, TextView tvFloorPrice, MemberCentralizedEntity entity) {
        // 集采分类 1商品集采 2 机械集采 3 设备集采 4 劳务集采 5房产集采 6租赁集采
        /*switch (entity.getGroupBuyClass()) {
            case 1:
            default:
                tvParamName.setText(tvParamName.getResources().getString(R.string.cm_commodity_param));
                tvFloorPrice.setText(tvFloorPrice.getResources().getString(R.string.cm_min_price));
                break;
            case 2:
                tvParamName.setText(tvParamName.getResources().getString(R.string.cm_machinery_param));
                tvFloorPrice.setText(tvFloorPrice.getResources().getString(R.string.cm_min_price));
                break;
            case 3:
                tvParamName.setText(tvParamName.getResources().getString(R.string.cm_equipment_param));
                tvFloorPrice.setText(tvFloorPrice.getResources().getString(R.string.cm_min_price));
                break;
            case 4:
                tvParamName.setText(tvParamName.getResources().getString(R.string.cm_labour_param));
                tvFloorPrice.setText(tvFloorPrice.getResources().getString(R.string.cm_labour_min_price));
                break;
        }*/
    }

    private void updateGroupBuyType(TextView textView, MemberCentralizedEntity entity) {
        switch (entity.getGroupBuyType()) {//集采类型: 1即报集采 2 汇总集采  3.企业专项
            case 1:
                textView.setText(textView.getResources().getText(R.string.jbjc));
                textView.setBackgroundResource(R.drawable.member_shape_gradient_blue);
                break;
            case 2:
                textView.setText(textView.getResources().getText(R.string.hzcg));
                textView.setBackgroundResource(R.drawable.member_shape_gradient_yellow);
                break;
            case 3:
                switch (entity.getOfferType()) {//报价类型: 0：市场报价   1：会员报价
                    case "1":
                        textView.setBackgroundResource(R.drawable.member_icon_hybg);
                        textView.setText("客户报价");
                        break;
                    case "2":
                        textView.setBackgroundResource(R.drawable.member_shape_bule_green_button);
                        textView.setText("市场报价");
                        break;
                    case "3":
                        textView.setBackgroundResource(R.drawable.member_shape_bule_green_button);
                        textView.setText("成员报价");
                        break;
                }
                break;
            default:
                textView.setVisibility(View.GONE);
                break;
        }
    }

    //第二类型标签     //报价类型: 1：商品材料   2：机械租赁  3：设备租赁
    private void updateSecondlyType(TextView tvSecondlyType, MemberCentralizedEntity entity) {
        switch (entity.getGroupBuyClass()) {//报价类型: 0：市场报价   1：会员报价
            case 1:
                tvSecondlyType.setVisibility(View.VISIBLE);
                tvSecondlyType.setText("商品材料");
                tvSecondlyType.setBackgroundResource(R.drawable.member_shape_gradient_blue);
                break;
            case 2:
                tvSecondlyType.setVisibility(View.VISIBLE);
                tvSecondlyType.setText("机械租赁");
                tvSecondlyType.setBackgroundResource(R.drawable.member_shape_gradient_blue);
                break;
            case 3:
                tvSecondlyType.setVisibility(View.VISIBLE);
                tvSecondlyType.setText("设备租赁");
                tvSecondlyType.setBackgroundResource(R.drawable.member_shape_gradient_blue);
                break;
            default:
                tvSecondlyType.setVisibility(View.GONE);
                break;
        }
    }

    //报价类型标签
    private void updateQuotationType(TextView tvQuotationType, MemberCentralizedEntity entity) {
        if (entity.getOfferType() == null) {
            tvQuotationType.setVisibility(View.GONE);
            return;
        }
        switch (entity.getOfferType()) {//报价类型: 0：市场报价   1：会员报价
            case "1":
                tvQuotationType.setVisibility(View.VISIBLE);
                tvQuotationType.setText("会员报价");
                tvQuotationType.setTextColor(Color.parseColor("#FDA72D"));
                tvQuotationType.setBackgroundResource(R.drawable.shape_centraly_yellow);
                break;
            case "2":
                tvQuotationType.setVisibility(View.VISIBLE);
                tvQuotationType.setTextColor(Color.parseColor("#0286DF"));
                tvQuotationType.setText("市场报价");
                tvQuotationType.setBackgroundResource(R.drawable.shape_centraly_blue);
                break;
            case "3":
                tvQuotationType.setVisibility(View.VISIBLE);
                tvQuotationType.setTextColor(Color.parseColor("#FF4B10"));
                tvQuotationType.setText("成员报价");
                tvQuotationType.setBackgroundResource(R.drawable.shape_centraly_red);
                break;
            default:
                tvQuotationType.setVisibility(View.GONE);
                break;
        }
    }

    //加盟客户类型
    private void updateJoinType(TextView tvJoinType, MemberCentralizedEntity entity) {
        if (entity.getJoinType() == null) {
            if (entity.getGroupBuyMode().equals("2")) {
                tvJoinType.setVisibility(View.VISIBLE);
                tvJoinType.setTextColor(Color.parseColor("#FDA72D"));
                tvJoinType.setText("客户加盟");
                tvJoinType.setBackgroundResource(R.drawable.shape_centraly_yellow);
            } else {
                tvJoinType.setVisibility(View.GONE);
            }
            return;
        }
        switch (entity.getJoinType()) {//1、市场加盟 2、会员加盟 3、成员加盟
            case "1":
                tvJoinType.setVisibility(View.VISIBLE);
                tvJoinType.setTextColor(Color.parseColor("#FDA72D"));
                tvJoinType.setText("客户加盟");
                tvJoinType.setBackgroundResource(R.drawable.shape_centraly_yellow);
                break;
            case "2":
                tvJoinType.setVisibility(View.VISIBLE);
                tvJoinType.setText("市场加盟");
                tvJoinType.setTextColor(Color.parseColor("#0286DF"));
                tvJoinType.setBackgroundResource(R.drawable.shape_centraly_blue);
                break;
            case "3":
                tvJoinType.setVisibility(View.VISIBLE);
                tvJoinType.setTextColor(Color.parseColor("#FF4B10"));
                tvJoinType.setText("成员加盟");
                tvJoinType.setBackgroundResource(R.drawable.shape_centraly_red);
                break;
            default:
                tvJoinType.setVisibility(View.GONE);
                break;
        }
    }

    // 物流货物
    private void logisticsGoods(ItemViewHolder holder, T t) {
        holder.setBinding(BR.viewModel, t);
        MemberLogisticsEntity entity = (MemberLogisticsEntity) t;
        ItemOtherLogisticsBinding binding = (ItemOtherLogisticsBinding) holder.getmBinding();
        binding.tvCity.setText(String.format("%s %s ➞ %s %s", entity.getCityName(),
                entity.getDistrictName(), entity.getDestCityName(), entity.getDestDistrictName()));

        // 显示竞价按钮
        if (entity.getPattern() == 1) {
            binding.tvTag.setVisibility(View.VISIBLE);
            if (!TextUtils.isEmpty(entity.getLowestPrice())) {
                binding.tvLowestPrice.setVisibility(View.VISIBLE);
                binding.tvLowestPrice.setText(Html.fromHtml("<font>最低报价 </font>" + "<font color='#000000'>" + NumberUtil.trim0(entity.getLowestPrice()) + "元/吨" + "</font>"));
                if (entity.getCarNumber() > 0) {
                    binding.carNumber.setText(Html.fromHtml("意向人数 " + "<font color='#5792FD'>" + entity.getCarNumber() + ">>" + "</font>"));
                    binding.carNumber.setVisibility(View.VISIBLE);
                } else {
                    binding.carNumber.setVisibility(View.GONE);
                }
            } else {
                binding.tvLowestPrice.setVisibility(View.GONE);
                binding.carNumber.setVisibility(View.GONE);
            }
        } else {
            binding.tvTag.setVisibility(View.GONE);
        }


        // 距您 44.7km
/*        if (TextUtils.isEmpty(entity.getJourney())) {
            binding.tvDistance.setText("");
            binding.tvDistance0.setText("");
        } else {
            binding.tvDistance.setText(String.format("距您 %s", Double.parseDouble(entity.getTotalDistance()) < 1000 ? "1km以内" : StringUtil.fromatUpDistance(entity.getTotalDistance()) + "km"));
            binding.tvDistance0.setText(String.format("距您 %s", Double.parseDouble(entity.getTotalDistance()) < 1000 ? "1km以内" : StringUtil.fromatUpDistance(entity.getTotalDistance()) + "km"));
        }*/

        binding.tvDistance.setText("");
        binding.tvDistance0.setText("");

        // 类型名称
        String wightStr = TextUtils.isEmpty(entity.getWeight()) || TextUtils.isDigitsOnly(entity.getWeight()) ? "" : "/" + entity.getWeight() + "吨";
        binding.typeName.setText(String.format("%s%s%s", entity.getGoodsModeName(), wightStr, TextUtils.isEmpty(entity.getVolume()) ? "" : "/" + NumberUtil.trim0(entity.getVolume()) + "方"));
        // 10/01 12点-7/15 15点 装货
        if (entity.getPattern() == 0) {
            //整车/零担
            String loadTypeStr = MCargoConstant.getTransportTypeStr(entity.getTransportType());
            if (loadTypeStr.equals("零担")) {
                binding.loadType.setVisibility(View.VISIBLE);
                binding.loadType.setImageResource(R.mipmap.member_icon_less_than_tag);
            } else if (loadTypeStr.equals("整车")) {
                binding.loadType.setVisibility(View.VISIBLE);
                binding.loadType.setImageResource(R.mipmap.member_icon_carload_tag);
            } else {
                binding.loadType.setVisibility(View.GONE);
            }
            //装货时间调整
            String loadTime = MCargoConstant.stampFormatListLoadTime(
                    entity.getShipmentTime(), entity.getStartPointTime(),
                    entity.getShipmentEndTime(), entity.getEndPointTime());
            if (!TextUtils.isEmpty(loadTime)) {
                binding.loadTime.setText(String.format("%s 装货", loadTime));
            } else {
                binding.loadTime.setVisibility(View.GONE);
            }

        } else {
            binding.loadType.setVisibility(View.GONE);
            //装货时间调整
            String loadTime = MCargoConstant.stampFormatListLoadTime(
                    entity.getShipmentTime(), entity.getStartPointTime(),
                    entity.getShipmentEndTime(), entity.getEndPointTime());
            if (!TextUtils.isEmpty(loadTime)) {
                binding.loadTime.setText(String.format("%s 装货", loadTime));
            } else {
                binding.loadTime.setVisibility(View.GONE);
            }
        }

        // 企业/团队/个人（司机）可装货
        String carModelNameStr = TextUtils.isEmpty(entity.getCarModelName()) ? "" : entity.getCarModelName();
        String carLenStr = TextUtils.isEmpty(entity.getCarLenName()) ? "" : " " + entity.getCarLenName();
        String heightHurdleStr = getValidHeightHurdle(entity.getHeightHurdle());
        String dumpStr = TextUtils.isEmpty(MVehicleConstant.getIsDumpStr(entity.getIsDump())) ? "" : " " + MVehicleConstant.getIsDumpStr(entity.getIsDump());
        if (entity.getPattern() == 1) {
            binding.contentView.setText(TextUtils.isEmpty(entity.getOfferType()) ? "" : entity.getOfferTypeWorlds() + " 可报价");
        } else {
            binding.contentView.setText(String.format("%s%s%s%s", carModelNameStr, carLenStr, heightHurdleStr, dumpStr));
        }

        // 运费 40000元
        // 一口价/电议
        if (entity.getFreightType() == 1) {
            binding.priceView.setText("运费 电议");
        } else {
            binding.priceView.setText(!entity.getAllFreight().isEmpty() ? "运费 " + NumberUtil.trim0(entity.getAllFreight()) + "元" : "");
        }
        // 运程 33.33km
        if (TextUtils.isEmpty(entity.getTotalDistance())) {
            binding.transportDistance.setText("");
            binding.transportDistance.setVisibility(View.GONE);
        } else {
            binding.transportDistance.setVisibility(entity.getPattern() == 1 ? View.GONE : View.VISIBLE);
            String journey = Double.parseDouble(entity.getTotalDistance()) < 1000 ? "1km以内" : StringUtil.fromatUpDistance(entity.getTotalDistance()) + "km";
            binding.transportDistance.setText(String.format("运程 %s", journey));
        }

        binding.carNumber.setOnClickListener(v -> {
            if (TextUtils.isEmpty(SharedPreferenceUtil.getInstance().
                    getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                MemberConfig.getInstance().startVerificationCodeLogin(context, 0);
            } else {
                if (MemberConfig.getInstance().isCompany() && MemberConfig.getInstance().getTeamOrCompanyNameNo().equals(entity.getCompanyNo()) && entity.getTerminal().equals("1")) {
                    //当前是企业并且跟货源发布人一致
                    MemberConfig.getInstance().startQuotedOwnerActivity(context, entity.getNo());
                } else if (MemberConfig.getInstance().isTeam() && MemberConfig.getInstance().getTeamOrCompanyNameNo().equals(entity.getTeamNo()) && entity.getTerminal().equals("2")) {
                    //当前是团队并且跟货源发布人一致
                    MemberConfig.getInstance().startQuotedOwnerActivity(context, entity.getNo());
                } else if (MemberConfig.getInstance().isPersonal() && MemberConfig.getInstance().getUserNo().equals(entity.getUserNo()) && entity.getTerminal().equals("3")) {
                    //当前是个人并且跟货源发布人一致
                    MemberConfig.getInstance().startQuotedOwnerActivity(context, entity.getNo());
                } else {
                    MemberConfig.getInstance().startQuotedOwnerActivity(context, entity.getNo());
                }
            }
        });


        binding.callPhone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!TextUtils.isEmpty(entity.getContrctsNumber()))
                    showDialog(entity.getContrctsNumber());
                else
                    MToast.showLongToast(v.getContext(), "无联系方式");
            }
        });
        if (!TextUtils.isEmpty(entity.getCompanyName())) {
            binding.tvCompany.setText(entity.getCompanyName());
        }
        if (!TextUtils.isEmpty(entity.getTerminal())) {
            binding.role.setVisibility(View.VISIBLE);
            switch (entity.getTerminal()) {
                case "1":
                    binding.role.setVisibility(View.VISIBLE);
                    break;
                case "2":
                    //个人不展示
                case "3":
                    binding.role.setVisibility(View.GONE);
                    break;
            }
        } else {
            binding.role.setVisibility(View.GONE);
        }
    }

    //企业服务
    private void serviceItem(ItemViewHolder holder, T t) {
        ItemOtherEnterpriseServiceBinding binding = (ItemOtherEnterpriseServiceBinding) holder.getmBinding();
        MemberServiceListBean serviceListEntiy = (MemberServiceListBean) t;
        binding.setModel(serviceListEntiy);
       /* if (flag) {
            binding.tvFollow.setVisibility(View.VISIBLE);
        } else {
            binding.tvFollow.setVisibility(View.GONE);
        }
        setFollwType(binding.tvFollow, serviceListEntiy.isAttention());*/

        if (!TextUtils.isEmpty(serviceListEntiy.getAuthTime())) {
            try {
                long i = Long.parseLong(serviceListEntiy.getAuthTime()) / (24 * 60 * 60 * 1000);
                if (i < 365) {
                    binding.tvTypeBj.setText(String.format("入驻%s天", i));
                } else {
                    binding.tvTypeBj.setText("入驻" + (i / 365) + "年");
                }

            } catch (Exception e) {
                e.printStackTrace();
            }

        }

        binding.tvFollow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (onItemClick != null) {
                    onItemClick.onItemClick(serviceListEntiy, -1);
                }
            }
        });
        try {
            String service = "/";
            if (!TextUtils.isEmpty(serviceListEntiy.getServiceScope()) && serviceListEntiy.getServiceScope().indexOf("[") > -1) {

                com.alibaba.fastjson.JSONArray jsonArray = com.alibaba.fastjson.JSONArray.parseArray(serviceListEntiy.getServiceScope());
                if (jsonArray.size() > 0) {
                    service = "";
                }
                for (int i = 0; i < jsonArray.size(); i++) {
                    com.alibaba.fastjson.JSONObject jsonObject = jsonArray.getJSONObject(i);
                    if (jsonObject.get("name") != null) {
                        service = service + jsonObject.getString("name") + "、";
                    }
                }
                if (!TextUtils.isEmpty(service) && service.indexOf("、") > -1) {
                    service = service.substring(0, service.length() - 1);
                }

            }

            binding.tvServiceFw.setText(service);

        } catch (Exception e) {
            e.printStackTrace();
        }
        RequestOptions options = new RequestOptions().placeholder(R.drawable.icon_default_shop)//图片加载出来前，显示的图片
                .fallback(R.drawable.icon_default_shop) //url为空的时候,显示的图片
                .error(R.drawable.icon_default_shop);//图片加载失败后，显示的图片
        RequestOptions teamOptions = new RequestOptions().placeholder(R.drawable.icon_wulogo_team_heand)//图片加载出来前，显示的图片
                .fallback(R.drawable.icon_wulogo_team_heand) //url为空的时候,显示的图片
                .error(R.drawable.icon_wulogo_team_heand);//图片加载失败后，显示的图片
        Glide.with(context).load(serviceListEntiy.getImg()).apply(options).into(binding.ivPublishType);
    }

    private String getValidHeightHurdle(String heightHurdle) {
        if (TextUtils.isEmpty(heightHurdle) || heightHurdle.equals("0.0")) {
            return "";
        }
        return " 栏高 " + NumberUtil.trim0(heightHurdle) + "米";
    }

    private void showDialog(String phone) {
        View view = View.inflate(context, R.layout.dialog_two_btn, null);
        final RoundCornerDialog roundCornerDialog = new RoundCornerDialog(context, 0, 0, view, R.style.RoundCornerDialog);
        roundCornerDialog.show();
        roundCornerDialog.setCanceledOnTouchOutside(false);// 设置点击屏幕Dialog不消失

        TextView tv_message = view.findViewById(R.id.tv_message);
        TextView tv_title = view.findViewById(R.id.tv_title);
        TextView tv_logout_confirm = view.findViewById(R.id.tv_logout_confirm);
        TextView tv_logout_cancel = view.findViewById(R.id.tv_logout_cancel);
        tv_title.setText("确认呼叫");
        tv_title.setVisibility(View.VISIBLE);
        tv_message.setText(phone);
        tv_logout_confirm.setText("拨打");
        //确定
        tv_logout_confirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_DIAL);
                Uri data = Uri.parse("tel:" + phone);
                intent.setData(data);
                context.startActivity(intent);
                roundCornerDialog.dismiss();

            }
        });
        //取消
        tv_logout_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                roundCornerDialog.dismiss();
            }
        });
    }
}
